<template>
    <div class="login-page">
        <div class="login-box">
          <div class="login-logo">
            <a><b>101</b>CRM</a>
          </div>
          <!-- /.login-logo -->
          <div class="login-box-body">
            <p class="login-box-msg">请输入账号密码登录</p>

            <form method="post">
              <div class="form-group has-feedback">
                <input v-model="loginid" class="form-control" placeholder="手机号码">
                <span class="glyphicon glyphicon-phone form-control-feedback"></span>
              </div>
              <div class="form-group has-feedback">
                <input type="password" v-model="password" class="form-control" placeholder="密码">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
              </div>
              <div class="row">
                <!-- /.col -->
                <div class="col-xs-4">
                  <button type="button" class="btn btn-primary btn-block btn-flat" @click="doLogin" :disabled="loading">登录</button>
                </div>
                <!-- /.col -->
              </div>
            </form>

          </div>
          <!-- /.login-box-body -->
        </div>
        <!-- /.login-box -->
    </div>

</template>

<script>

import Auth from '@/modules/Auth'

export default {
    name:'Login',
    data() {
        return {
            loginid:'15553308180',
            password:'123456',
            loading:false,
        };
    },
    computed: {},
    ready() {},
    attached() {},
    methods: {
        doLogin() {
            this.loading = true;
            var self = this;
            setTimeout(function(){
                Auth.attempt(self.loginid,self.password)
                .then(function(response){
                    self.loading = false;
                    // console.log('登录成功');
                    self.$router.push({name:'Dashboard'});
                },function(response){
                    self.loading = false;
                });
            },1000);
        }
    },
    components: {}
};
</script>
<style>
html{background:#ecf0f5;margin:0px !important;padding:0px !important;}
body{background:#ecf0f5;height:300px;}
.login-page{background-color:#ecf0f5;}
</style>
